package com.csw.shuanfa.SuanFa.huaWei.huaweijikao;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

/**
 * abcdd dd aabbcc empty
 *
 * @author 1
 */
@Slf4j
public class LessDeleteZiFu {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        char[] inOut = input.toCharArray();
        Map<Character, Integer> map = new HashMap<>(16);
        /* 统计每个字母出现的次数 */
        for (char c : inOut) {
            map.merge(c, 1, Integer::sum);
        }
        /* 找出最小次数 */
        int minShu = 999;
        for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            if (minShu > entry.getValue()) {
                minShu = entry.getValue();
            }
        }
        log.error("" + "minShu" + minShu);
        /* 找出出现最小次数的字母 */
        List<Character> list = new ArrayList<>();
        for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            if (minShu == entry.getValue()) {
                log.info("" + "list添加" + minShu);
                list.add(entry.getKey());
            }
        }
        StringBuilder abc = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < input.length(); j++) {
                String o1 = list.get(i) + "";
                String o2 = String.valueOf(input.charAt(j));
                if (o1.equals(o2)) {
                    continue;
                }
                abc.append(input.charAt(j));
            }
            input = abc.toString();
            abc = new StringBuilder();
        }
        log.info("" + "input.size" + input.length());
        if (input.length() == 0) {
            log.info("" + "empty");
        } else {

            log.info("" + input);
        }
    }
}
